import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

import XmGlMain from "@/views/xmGl/index"
import XmGlDetailsMain from "@/views/xmGl/components/details"
import SetPermissionsMain from "@/views/xmGl/components/setPermissions"
import association from "@/views/xmGl/components/association"

// import XmRwMain from "@/views/xmRw/index"
export const constantRoutes = [{
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    redirect: '/grzx',
    children: [{
      path: 'grzx',
      component: () => import('@/views/grzx/index'),
      meta: {
        title: '个人中心',
        icon: 'dashboard'
      }
    }]
  },
  {
    path: '/zxgl',
    component: Layout,
    children: [{
      path: '/zxgl',
      component: () => import('@/views/zxgl/index'),
      meta: {
        title: '资讯管理',
        icon: 'example'
      }
    }]
  },

  {
    path: '/yhgl',
    component: Layout,
    children: [{
      path: '/yhgl',
      component: () => import('@/views/yhgl/index'),
      meta: {
        title: '用户管理',
        icon: 'el-icon-user-solid'
      }
    }]
  },
  {
    path: "/xmGl",
    component: Layout,
    children: [{
      path: "/xmGl",
      component: () => import('@/views/xmGl/index'),
      meta: {
        title: '接入管理',
        icon: 'el-icon-link'
      }
    }]
  },
  {
    path: "/xmGlDetails",
    component: Layout,
    hidden: true,
    children: [{
      path: "/xmGlDetails",
      component: () => import('@/views/xmGl/components/details'),
      meta: {
        title: '接入管理-详情',
        icon: 'el-icon-user-solid'
      }
    }]
  },
  {
    path: "/xmGlAdd",
    component: Layout,
    hidden: true,
    children: [{
      path: "/xmGlAdd",
      component: () => import('@/views/xmGl/components/details'),
      meta: {
        title: '接入管理-新增',
        icon: 'el-icon-user-solid'
      }
    }]
  },
  {
    path: "/setPermissions",
    component: Layout,
    hidden: true,
    children: [{
      path: "/setPermissions",
      component: () => import('@/views/xmGl/components/setPermissions'),
      meta: {
        title: '接入管理-设置权限',
        icon: 'el-icon-user-solid'
      }
    }]
  },
  {
    path: "/association",
    component: Layout,
    hidden: true,
    children: [{
      path: "/association",
      component: () => import('@/views/xmGl/components/association'),
      meta: {
        title: '接入管理-关联用户',
        icon: 'el-icon-user-solid'
      }
    }]
  },

  {
    path: '/dwgl',
    component: Layout,
    children: [{
      path: '/dwgl',
      component: () => import('@/views/dwgl/index'),
      meta: {
        title: '单位管理',
        icon: 'el-icon-s-data'
      }
    }]
  },
  {
    path: '/xytjg',
    component: Layout,
    meta: {
      title: '新业态监管',
      icon: 'el-icon-menu'
    },
    children: [
      {
        path: '/dzxspgl',
        component: () => import('@/views/bagl/dzxspgl/index'),
        meta: {
          title: '电子显示屏概览',
          icon: 'el-icon-s-claim'
        }
      },
      {
        path: '/dzxspba',
        component: () => import('@/views/bagl/dzxspba/index'),
        meta: {
          title: '电子显示屏备案',
          icon: 'el-icon-s-claim'
        }
      },
      {
        path: '/wycba',
        component: () => import('@/views/bagl/wycba/index'),
        meta: {
          title: '网约车平台备案',
          icon: 'el-icon-s-claim'
        }
      },
    ]
  },

  {
    path: '/bagl',
    name: '备案管理',
    component: Layout,
    meta: {
      title: '备案管理',
      icon: 'el-icon-s-goods'
    },
    children: [
      {
        path: '/batj',
        component: () => import('@/views/bagl/batj/index'),
        meta: {
          title: '备案概览',
          icon: 'el-icon-s-claim'
        }
      },
      {
        path: '/websiteba',
        component: () => import('@/views/bagl/websiteba/index'),
        meta: {
          title: '网站备案',
          icon: 'el-icon-s-claim'
        }
      },
      {
        path: '/appba',
        component: () => import('@/views/bagl/appba/index'),
        meta: {
          title: 'APP备案',
          icon: 'el-icon-s-claim'
        }
      },
      {
        path: '/xcxba',

        component: () => import('@/views/bagl/xcxba/index'),
        meta: {
          title: '小程序备案',
          icon: 'el-icon-s-claim'
        }
      },
      {
        path: '/mcnba',
        component: () => import('@/views/bagl/mcnba/index'),
        meta: {
          title: 'MCN机构备案',
          icon: 'el-icon-s-claim'
        }
      },
      {
        path: '/lltgjgba',
        component: () => import('@/views/bagl/lltgjgba/index'),
        meta: {
          title: '流量推广机构备案',
          icon: 'el-icon-s-claim'
        }
      },
      {
        path: '/dvwhba',
        component: () => import('@/views/bagl/dvwhba/index'),
        meta: {
          title: '大V网红备案',
          icon: 'el-icon-s-claim'
        }
      },
      {
        path: '/fjyxcsba',
        component: () => import('@/views/bagl/fjyxcsba/index'),
        meta: {
          title: '非经营性场所备案',
          icon: 'el-icon-s-claim'
        }
      },
      {
        path: '/fwsba',
        component: () => import('@/views/bagl/fwsba/index'),
        meta: {
          title: '服务商备案',
          icon: 'el-icon-s-claim'
        }
      }
    ]
  },


  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]
const createRouter = () => new Router({
  // mode: 'history', 
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRoutes
})
const router = createRouter()
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher
}
export default router
